package com.yanggeng.demo.beginnerguidedemo.activity.customview;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.yanggeng.demo.beginnerguidedemo.R;
import com.yanggeng.demo.beginnerguidedemo.activity.BaseActivity;
import com.yanggeng.demo.beginnerguidedemo.widget.SignView;

/**
 * 签名
 * @author aiden@tronsis.com
 * @date 2018/5/24 17:43
 */
public class SignActivity extends BaseActivity {

    private SignView signView;
    private ImageView ivSign;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign);
        setTitle(true, "签字", "清除");
        signView = (SignView) findViewById(R.id.sign_view);
        ivSign = (ImageView) findViewById(R.id.iv_sign);
        findViewById(R.id.btn_save).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ivSign.setImageBitmap(signView.getCacheBitmap());
            }
        });
    }

    @Override
    protected void navigationOnclick(int paramId) {
        super.navigationOnclick(paramId);
        if (paramId == RIGHT_TEXT) {
            signView.clear();
        }
    }
}
